doc: document URLPattern instance getters - #65804
Open
charpeni wants to merge 1 commit into
Open
Conversation
`URLPattern` instances expose the `protocol`, `username`, `password`, `hostname`, `port`, `pathname`, `search` and `hash` getters, which return the pattern string of each component, and the `hasRegExpGroups` getter. They have been available since the initial implementation but were never documented. Refs: https://urlpattern.spec.whatwg.org/#dom-urlpattern-protocol Refs: https://urlpattern.spec.whatwg.org/#dom-urlpattern-hasregexpgroups
Contributor
|
Welcome to Node.js, and thank you for your first contribution! Before review, please take a moment to read:
Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal. |
URLPattern instance getters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
URLPatterninstances expose theprotocol,username,password,hostname,port,pathname,searchandhashgetters, which return the pattern string of each component, and thehasRegExpGroupsgetter. They are implemented insrc/node_url_pattern.cc, were part of the initial URLPattern implementation that shipped in v23.8.0, and are defined by the URL Pattern Standard, butdoc/api/url.mdnever documented them.This adds one subsection per getter to the
URLPatternclass section, placed beforeexec()andtest()to mirror the layout of theURLclass, each with theadded: v23.8.0metadata and a short example.Every example output was verified by running the example code on v24.19.0.
Note
Disclosure per the AI use policy: Claude Fable 5.1 (Anthropic), running in Claude Code, was used to audit this page and draft the change. I reviewed the diff and verified the output myself, and I will handle review feedback personally.
Refs: https://urlpattern.spec.whatwg.org/#dom-urlpattern-hasregexpgroups